﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Category.ascx.cs" Inherits="admin_Modules_Category" %>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="error" />
<table width="100%">
    <tr>
        <td width="120px" class="req">
            Tên danh mục :
        </td>
        <td>
            <asp:TextBox ID="txtCatName" runat="server" Width="250px"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Nhập tên danh mục"
                ControlToValidate="txtCatName" Display="Dynamic">*</asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
            Danh mục cha
        </td>
        <td>
            <asp:DropDownList ID="ddlCatParent" runat="server" AppendDataBoundItems="true" Width="150px">
                <asp:ListItem Value="">Danh mục gốc</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            Loại danh mục
        </td>
        <td>
            <asp:DropDownList ID="ddlCatType" runat="server" Width="150px">
                <asp:ListItem Value="NEWS">Tin tức</asp:ListItem>
                <asp:ListItem Value="PROD">Sản phẩm</asp:ListItem>
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td>
            <asp:HiddenField ID="hidId" runat="server" />
        </td>
        <td>
            <asp:Button ID="btnUpdate" runat="server" Text="Thêm" OnClick="btnUpdate_Click" />
        </td>
    </tr>
</table>
<table class="table">
    <tr>
        <th width="30px">
        </th>
        <th>
            Tên danh mục
        </th>
        <th width="90px">
            Loại
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
        <th width="40px">
        </th>
    </tr>
    <asp:Repeater ID="repParent" runat="server" OnItemCommand="repParent_ItemCommand"
        OnItemDataBound="repParent_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td>
                </td>
                <td>
                    <%# Eval("CatName") %>
                </td>
                <td>
                    <%# Eval("CatType").ToString() == "NEWS" ? "Tin tức" : "Sản phẩm" %>
                </td>
                <td>
                </td>
                <td align="center">
                    <asp:LinkButton ID="edit" runat="server" CommandName="edit" CommandArgument='<%# Eval("Id") %>'
                        ValidationGroup="edit"><img src="images/edit.png" /></asp:LinkButton>
                </td>
                <td align="center">
                    <asp:LinkButton ID="del" runat="server" CommandName="del" CommandArgument='<%# Eval("Id") %>'
                        OnClientClick="return confirm('Bạn xác nhận xóa dữ liệu?')" ValidationGroup="del"><img src="images/delete.png" /></asp:LinkButton>
                </td>
            </tr>
            <asp:Repeater ID="rep" runat="server" OnItemCommand="repParent_ItemCommand">
                <ItemTemplate>
                    <tr>
                        <td>
                        </td>
                        <td>
                            &nbsp;&nbsp;&nbsp;---&nbsp;<%# Eval("CatName") %>
                        </td>
                        <td>
                            <%# Eval("CatType").ToString() == "NEWS" ? "Tin tức" : "Sản phẩm" %>
                        </td>
                        <td>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="edit" runat="server" CommandName="edit" CommandArgument='<%# Eval("Id") %>'
                                ValidationGroup="edit"><img src="images/edit.png" /></asp:LinkButton>
                        </td>
                        <td align="center">
                            <asp:LinkButton ID="del" runat="server" CommandName="del" CommandArgument='<%# Eval("Id") %>'
                                OnClientClick="return confirm('Bạn xác nhận xóa dữ liệu?')" ValidationGroup="del"><img src="images/delete.png" /></asp:LinkButton>
                        </td>
                    </tr>
                </ItemTemplate>
            </asp:Repeater>
        </ItemTemplate>
    </asp:Repeater>
</table>
